#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QSerialPort>
#include <QDebug>
#include <QSerialPortInfo>
#include <QStandardItemModel>
#include <QModelIndexList>
#pragma pack(push,1)
typedef struct {
    uint8_t value;
    uint16_t pNWK;
    uint16_t myNWK;

}RXBF;
typedef struct {
    uint16_t myNWK;
    QStandardItem* item;
}RXBFather;
#pragma pack(pop)
namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT
public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();
    void initUI();
    QStringList getPortNameList();
    void openPort();
    void disZigbee(RXBF rxEnd);
public slots:
    void receiveInfo();

private:
    Ui::Widget *ui;
    QSerialPort *m_seriaPort;
    QStringList m_portNameList;
    QByteArray infoBuf;
    QVector<RXBF> rxbf;
    QVector<RXBFather> rxbfather;
    QStandardItemModel* model;
    QMap<QString,QIcon>m_publicIconMap;
    int coorFlag = 0;
};

#endif // WIDGET_H
